#include <iostream>

#include <Presentation/IoManager.hpp>


namespace Fibonacci
{
namespace Presentation
{


IoManager::IoManager(
    std::istream& is_,
    std::ostream& os_,
    std::shared_ptr<Model::IFibonacciNumberCalculator> calculator_)
  : is(is_),
    os(os_),
    calculator(calculator_)
{
}


void IoManager::run()
{
  unsigned n;
  is >> n;
  unsigned fib = calculator->get(n);
  os << fib << std::endl;
}


} // namespace Presentation
} // namespace Fibonacci
